package com.jianzh5.dao;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

public interface BaseDaoI<T> {
	
	public Serializable save(T o);
	
	public void delete(T o);

	public void update(T o);

	public void saveOrUpdate(T o);

	public T get(Class<T> c, Serializable id);

	public T get(String hql);

	public T get(String hql, Map<String, Object> params);

	public List<T> find(String hql);

	public List<T> find(String hql, Map<String, Object> params);

	public List<T> find(String hql, int page, int rows);
	
	//新增分页方法，如果前台传递参数为起始位置 和 每页显示的条数，则之前的分页方法不可用
	public List<T> findByPosition(String hql, int start, int length);
    public List<T> findByPosition(String hql, Map<String, Object> params, int start, int length);
	
	public List<T> find(String hql, Map<String, Object> params, int page, int rows);
	
	//增加使用sql语句查询方法，返回需要的对象
	public List<T> queryBySql(String sql, Class<T> c);

	public long count(String hql);

	public long count(String hql, Map<String, Object> params);

	public int executeHql(String hql);

	public int executeHql(String hql, Map<String, Object> params);
	
}
